package com.bjpowernode.javaWeb.servlet;

import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;

import java.io.IOException;

public class LoginServlet extends GenericServlet{
    //如果需要重写init方法

    //父类将原始的init方法final了，子类没有办法重写这个init了
//    @Override
//    public void init(ServletConfig config) throws ServletException {
//        super.init(config);
//    }


    @Override
    public void init() {
        System.out.println("LoginServlet's init method execute");
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("正在处理用户登录请求，请稍后...");
        //在子类中想使用父类中的ServletConfig对象
        ServletConfig config=getServletConfig();
        System.out.println("ServletConfig对象是："+config);
    }
}
